package com.ccrfid.rmc6.pojo.dto;

import java.sql.Timestamp;

public class TimeRecord {
    private Timestamp startTime;
    private Timestamp stopTime;
    private Long seconds;

    public TimeRecord() {
    }

    public TimeRecord(Timestamp startTime, Timestamp stopTime) {
        this.startTime = startTime;
        this.stopTime = stopTime;
        if (stopTime != null && startTime != null) {
            this.seconds = (stopTime.getTime() - startTime.getTime()) / 1000;
        }
    }

    public Timestamp getStartTime() {
        return startTime;
    }

    public void setStartTime(Timestamp startTime) {
        this.startTime = startTime;
        if (this.stopTime != null && this.startTime != null) {
            this.seconds = (stopTime.getTime() - startTime.getTime()) / 1000;
        }
    }

    public Timestamp getStopTime() {
        return stopTime;
    }

    public void setStopTime(Timestamp stopTime) {
        this.stopTime = stopTime;
        if (this.stopTime != null && this.startTime != null) {
            this.seconds = (stopTime.getTime() - startTime.getTime()) / 1000;
        }
    }

    public Long getSeconds() {
        return seconds;
    }

    public void setSeconds(Long seconds) {
        this.seconds = seconds;
    }
}
